feat: update notification services to support mobile.#5120
feat: update notification services to support mobile.#5120Prithpal-Sooriya merged 10 commits intomainfrom
Conversation
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
...ices-controller/src/NotificationServicesPushController/NotificationServicesPushController.ts
Show resolved
Hide resolved
...ion-services-controller/src/NotificationServicesPushController/__fixtures__/mockMessenger.ts
Show resolved
Hide resolved
...notification-services-controller/src/NotificationServicesPushController/services/services.ts
Show resolved
Hide resolved
.../notification-services-controller/src/NotificationServicesPushController/web/push-helpers.ts
Show resolved
Hide resolved
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
29ca3da to
21576f2
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
c4913ce to
9f24308
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
...ion-services-controller/src/NotificationServicesController/NotificationServicesController.ts
Show resolved
Hide resolved
…ouple-push-logic-to-be-platform-agnostic
I'll double check the other notification methods in a separate PR.
mathieuartu
left a comment
There was a problem hiding this comment.
Perfect, thanks for addressing the changes! LGTM!!
Explanation
This is a large PR that enables support for push notifications on mobile.
Makes Push Notification Controller Platform Agnostic
The
NotificationServicesPushControllerwas highly tied to web and was not compatible for react-native.We now have isolated the web logic in
web/push-utils.ts, and allow platforms to overwrite and inject a push service into the controller. E.g. Mobile can inject push services using react-native modules.Add support to toggle push notifications on/off in isolation
This allows us to decouple in-app notifications from push notifications. It is done by adding a
isPushEnabledboolean inside theNotificationServicesPushController.We have also added public methods
enablePushNotificationsanddisablePushNotificationsinside theNotificationServicesControllerto allow us tie it to UI Actions.References
Changelog
@metamask/notification-services-controllerisPushEnabledstate toNotificationServicesPushControllerStateto enable and disable this controller/isUpdatingFCMTokenstate toNotificationServicesPushControllerStateto track when the controller is updating for firebase registration token.PushServiceinterface and default web implementation for push notifciationsNotificationServicesPushControllerconfig now allows injecting of aPushServiceinterface during controller creation./push-services/websubpath export to import web specific push services./sharedfolder including some shared utils used in controllers for this package.enablePushNotificationsanddisablePushNotificationsinNotificationServicesControllerto enable and disable push notifications in isolation.Checklist